<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef" @selection-change="setSelectedKeys" :selected-keys="ids" :isVTable='false'>
      <!-- <template #tableBeforeButtons>
            <a-button type="primary" @click="handleClick">批量回箱</a-button>
      </template> -->
      <template #deriver_box_status="{record}">
        <div>{{ record.deriver_box_status == 1?'待到站':record.deriver_box_status == 2?'已入园':record.deriver_box_status == 3?'在途':record.deriver_box_status == 4?'预约还箱':record.deriver_box_status == 5 && record.huan_time !=null ?'已还箱':record.deriver_box_status == 5 && record.retrun_time ==null ?'已掏箱':record.deriver_box_status == 6 && record.hui_time !=null ?'已回送':record.deriver_box_status == 6 && record.hui_time ==null ?'无需还箱':'' }}</div>
      </template>
      <template #dept_id="{ record }">
        <!-- 对标题加上 tag -->
        <a-tag color="blue">{{ record?.prediction?.dept?.name }}</a-tag>
      </template>
      <template #warehouse_id="{ record }">
        <!-- 对标题加上 tag -->
        <div v-if="record.prediction != null">{{record?.deriver_box_status!=0?record.prediction.warehouse_link?.warehouse?.name? record.prediction.warehouse_link?.warehouse?.name + '-' + record.prediction.warehouse_link?.horizontal_position + '-' + record.prediction.warehouse_link?.release_position + '-' + record.prediction.warehouse_link?.reaches_position:'' :'已离场'}}</div>
        <div v-else>-</div>
      </template>
      <template #operationCell="{ record }">
        <a-link @click='handlereturnBoxShow(record)' v-if='record?.deriver_box_status == 3'>预约还箱</a-link>
        <a-popconfirm content="是否确认撤销预约还箱?" @ok="handleClickChexiao(record)">
          <a-link v-if='record?.deriver_box_status == 4'>撤销</a-link>
        </a-popconfirm>
        <a-popconfirm content="是否确认收到回箱?" @ok="handleClicktielu(record)">
          <a-link v-if='record?.deriver_box_status == 5 && record?.is_tielu == 1'>确认回箱</a-link>
        </a-popconfirm>
        <!-- <a-link @click='handleZhangdan(record)' v-if='record?.deriver_box_status >= 4'>账单</a-link> -->
        <a-link v-if='record?.deriver_box_status == 5 && record?.is_empty == 1' @click='handleEdit(record)'>编辑</a-link>
      </template>
    </ma-crud>

    <a-modal :mask-closable="false" 
      v-model:visible="returnBoxShow"
      title="批量回箱"
      @cancel="handleCelReturnBox"
      :width="1400"
      :on-before-ok="handleReturnBox"
      v-if="returnBoxShow"
    >
    <a-table
        :columns="columnsReturn"
        :bordered="{ wrapper: true, cell: true }"
        :data="returnList"
        :pagination="false"

      >
        <template #is_empty="{ record }">
          <!-- 对标题加上 tag -->
          <div >{{ record?.is_empty == 1?'空箱':'重箱' }}</div>
        </template>
        <template #deriver_box_status="{ record }">
          <!-- 对标题加上 tag -->
          <div >{{ record?.deriver_box_status == 0?'未还箱':record?.deriver_box_status == 1?'已预约还箱':record?.deriver_box_status == 2?'已还箱':record?.deriver_box_status == 3?'待回箱':record?.deriver_box_status == 4?'已入箱':'已回箱' }}</div>
        </template>
        <template #warehouse_id="{ record }">
          <!-- 对标题加上 tag -->
          <div >{{record?.deriver_box_status!=0? record.prediction.warehouse_link?.warehouse.name + '-' + record.prediction.warehouse_link?.horizontal_position + '-' + record.prediction.warehouse_link?.release_position + '-' + record.prediction.warehouse_link?.reaches_position :'已离场'}}</div>
        </template>
      </a-table>
    <div style="margin-top: 2%;">
      <div style="margin-bottom: 2%;display: flex; align-items: center;">
        <div style="width: 100px;">回箱火车号</div>
        <a-input v-model="go_car_no" placeholder="请输入回箱火车号" allow-clear />
      </div>
      <div style="margin-bottom: 2%;display: flex; align-items: center;">
        <div style="width: 100px;">到站</div>
        <a-input v-model="daozhan" placeholder="请输入到站" allow-clear />
      </div>
      <div style="margin-bottom: 2%;display: flex; align-items: center;">
        <div style="width: 100px;">调度命令号</div>
        <a-input v-model="ddmlh" placeholder="请输入调度命令号" allow-clear />
      </div>
      <div style="margin-bottom: 2%;display: flex; ">
        <div style="width: 100px;">备注</div>
        <a-textarea v-model="remark" placeholder="请输入备注" allow-clear/>
      </div>
    </div>
    </a-modal>
    <!--  -->
    <a-modal :mask-closable="false"  v-model:visible="showCK" title="修改存放位置" @cancel="handleShow"  :width="600" :on-before-ok="handleOk">
      <div style="font-size:16px;margin-bottom:16px">请选仓位：</div>
      <div style="display:flex;justify-content: center;align-items: center;flex-direction: column;">
        <div style="display:flex; align-items: center;margin-bottom:16px">
          <div style="width:50px">仓库：</div>
          <a-select v-model="cangId" :style="{width:'320px'}" placeholder="请选择仓库" @change="cangChang">
            <a-option v-for="(item,index) in cangkuList" :value="item.id" :key="index">{{ item.name}}</a-option>
          </a-select>
        </div>
        <div style="display:flex; align-items: center;margin-bottom:16px">
          <div style="width:50px">横：</div>
          <a-select v-model="hengId" :style="{width:'320px'}" placeholder="请选择横"  v-if="hengList.length != 0">
            <a-option v-for="(item,index) in hengList" :value="item.id" :key="index">{{ item.name }}</a-option>
          </a-select>
          <div style="width:320px;font-size:14px;padding:4px 12px;background:rgba(242, 243, 245,1);border-radius:4px;min-height:30px" v-else>{{ hengId }}</div>
        </div>
        <div style="display:flex; align-items: center;margin-bottom:16px">
          <div style="width:50px">纵：</div>
          <a-select v-model="zongId" :style="{width:'320px'}" placeholder="请选择纵"  v-if="zongList.length != 0">
            <a-option v-for="(item,index) in zongList" :value="item.id" :key="index">{{ item.name }}</a-option>
          </a-select>
          <div style="width:320px;font-size:14px;padding:4px 12px;background:rgba(242, 243, 245,1);border-radius:4px;min-height:30px" v-else>{{ zongId }}</div>
        </div>
        <div style="display:flex; align-items: center;margin-bottom:16px">
          <div style="width:50px">层：</div>
          <a-select v-model="cengId" :style="{width:'320px'}" placeholder="请选择层"  v-if="cengList.length != 0">
            <a-option v-for="(item,index) in cengList" :value="item.id" :key="index">{{ item.name }}</a-option>
          </a-select>
          <div style="width:320px;font-size:14px;padding:4px 12px;background:rgba(242, 243, 245,1);border-radius:4px;min-height:30px" v-else>{{ cengId }}</div>
        </div>
      </div>
    </a-modal>
    <a-modal :mask-closable="false"  v-model:visible="returnBoxsShow" title="预约还箱" @cancel="handlecancelreturnBoxsShow" :width="600" :on-before-ok='handlereBeforeTurnBoxsOk' >
      <!-- :style="{ width: '600px' }" -->
      <a-form :model="formData"  @submit="handleSubmit">
        <a-form-item field="box" label="箱号">
          <a-input v-model="formData.box" placeholder="请输入箱号" disabled />
        </a-form-item>
        <a-form-item field="box_type" label="箱型箱类">
          <a-input v-model="formData.box_type" placeholder="请输入箱型箱类" disabled />
        </a-form-item>
        <a-form-item field="driver_name" label="还箱司机">
          <a-input v-model="formData.driver_name" placeholder="请输入还箱司机" disabled />
        </a-form-item>
        <a-form-item field="driver_mobile" label="还箱司机电话">
          <a-input v-model="formData.driver_mobile" placeholder="请输入还箱司机电话" disabled />
        </a-form-item>
        <a-form-item field="driver_car_no" label="装车车牌号">
          <a-input v-model="formData.driver_car_no" placeholder="请输入装车车牌号" disabled />
        </a-form-item>
        <a-form-item field="is_tielu" label="还箱地点">
          <a-select v-model="formData.is_tielu"  placeholder="请选择还箱地点">
            <a-option v-for="item of is_tieluArr" :value="item.value" :label="item.title" />
          </a-select>
        </a-form-item>
        <a-form-item field="retrun_car_no" label="还箱车牌号">
          <a-input v-model="formData.retrun_car_no" placeholder="请输入还箱车牌号" />
        </a-form-item>
      </a-form>
    </a-modal>
    <!-- 账单 -->
    <a-drawer
        v-model:visible="orderShowItemsShow"
        :footer="false"
        :width="1400"
    >
      <template #title> 账单</template>
      <OrderShowItems  ref="orderShowItemsRef" :info='orderShowItem' v-if='orderShowItemsShow'/>
    </a-drawer>
  </div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import predictionBox from '@/api/prediction/predictionBox'
import { Message } from '@arco-design/web-vue'
import { request } from "@/utils/request.js";
import OrderShowItems from "./orderShowItems.vue"
import tool from '@/utils/tool'
import * as common from '@/utils/common'
const ids = ref([])
const crudRef = ref()
const returnList = ref([])
const returnBoxShow = ref(false)
const go_car_no = ref('')
const daozhan = ref('')
const ddmlh = ref('')
const remark = ref('')
const returnBoxsShow = ref(false)
const rowData = ref({})
const editId = ref('')
const cangkuList = ref([])
const showCK = ref(false)
const orderShowItemsShow = ref(false)
const orderShowItem = ref()
const orderShowItemsRef = ref();
const cangId = ref()
const hengList = ref([])
const hengId = ref()
const zongList = ref([])
const zongId = ref()
const cengList = ref([])
const cengId = ref()
const formData = ref({
  box:'',
  box_type:'',
  driver_name:'',
  driver_mobile:'',
  driver_car_no:'',
  is_tielu:'2',
  retrun_car_no:'',
})
const is_tieluArr = ref([
  {title:'普兴站',value:'1'},
  {title:'园区',value:'2'},
])
const handleZhangdan = (item)=>{
  orderShowItemsShow.value = true
  orderShowItem.value = item
}
const setSelectedKeys = (keyArr)=>{
  ids.value = keyArr
}
onMounted(()=>{
  // setTimeout(()=>{
  //   console.log(document.getElementsByClassName("arco-table-td")[2].style.width = '300px')
  // },500)
  
})
const handlereturnBoxShow = (row) =>{
  rowData.value = row
  formData.value.box = row.box
  formData.value.box_type = row.box_type
  formData.value.driver_name = row.driver_name
  formData.value.driver_mobile = row.driver_mobile
  formData.value.driver_car_no = row.driver_car_no
  formData.value.is_tielu = '2'
  formData.value.retrun_car_no = row.driver_car_no
  
  returnBoxsShow.value = true
}
const handlecancelreturnBoxsShow = () =>{
  returnBoxsShow.value = false
}
const handlereBeforeTurnBoxsOk = async ()=>{
  if(formData.value.retrun_car_no == ''){
    Message.error('请输入还箱车牌号')
    return false
  }else{
    let res = await predictionBox.update(rowData.value.id,{
      retrun_car_no: formData.value.retrun_car_no,
      retrun_time:tool.dateFormat(
        Math.round(new Date().getTime() / 1000).toString(),
        "yyyy-MM-dd hh:mm:ss"
      ),
      deriver_box_status:4,
      is_tielu:formData.value.is_tielu
    })
    if(res.code == 200){
      Message.success('预约还箱成功')
      crudRef.value.refresh()
      return true
      
    }else{
      Message.error(res.message)
      return false
    }
    
  }
}
const handleClickChexiao =  (row)=>{
  predictionBox.update(row.id,{
    deriver_box_status:3,
  }).then(res=>{
    Message.success('撤销成功！！')
    crudRef.value.refresh()
  })
}

const handleEdit = (row)=>{
  request({
      url: "/warehouse/master/index",
      method: "get",
      params: {
        // dept_id:row.dept_id,
        // goods_id:row.goods_id,
      },
    }).then((res) => {
      cangkuList.value = res.data.items;
      cangId.value = ''
      hengId.value = ''
      hengList.value = []
      zongList.value = []
      zongId.value = ''
      cengList.value = []
      cengId.value = ''
      showCK.value = true
      editId.value = row.id
    });
}
const cangChang = (e)=>{
  let hengArr = [];
  let zongArr = [];
  let cengArr = [];
  cangkuList.value.map((v,i)=>{
      if(v.id == e){
        for(var i = 1;i<=(v.horizontal_span - 0);i++){
          hengArr.push({name:i,id:i})
        }
        for(var m = 1;m<=(v.release_span - 0);m++){
          zongArr.push({name:m,id:m})
        }
        for(var z = 1;z<=(v.reaches - 0);z++){
          cengArr.push({name:z,id:z})
        }
      }
    })
  hengList.value = hengArr
  zongList.value = zongArr
  cengList.value = cengArr
  
}
const handleShow = ()=>{
  
  showCK.value = false
}
const handleOk = async () =>{   // 确认入库
  if(!cangId.value){
    Message.error('请选择仓库')
    return false
  }
  if(!hengId.value){
    Message.error('请选择横')
    return false
  }
  if(!zongId.value){
    Message.error('请选择纵')
    return false
  }
  if(!cengId.value){
    Message.error('请选择层')
    return false
  }
  let warehouse_id = 0
  warehouse_id = cangId.value
  let res = await request({
		url: "/prediction/box/update" + `/${editId.value}`,
		method: "put",
		data: {
			warehouse_id:warehouse_id,
      horizontal_position:hengId.value,
      release_position:zongId.value,
      reaches_position:cengId.value,
		},
	})
  if(res.code == 200){
    Message.success('修改成功')
    crudRef.value.refresh()
    return true
  }else{
    Message.error(res.message)
    return false
  }
}
const handleClick = ()=>{
  if(ids.value.length == 0){
    return Message.error('请选择归还的集装箱')
  }
  predictionBox.getData({ids:ids.value.join(',')}).then(res=>{
    let _data = res.data
    _data.map((v,i)=>{
      v.dept_name = v.prediction.dept.name
      v.car_no = v.prediction.car_no
    })
    returnList.value = _data
    returnBoxShow.value = true
  })
}
const handleClicktielu = (row)=>{
  request({
    url: "prediction/box/changeStatus",
    method: "put",
    data: {
      id:row.id,
      statusValue:6,
      statusName:'deriver_box_status',
    },
  }).then((res) => {
      Message.success('已确认')
      crudRef.value.refresh()
  });
}
const handleCelReturnBox = ()=>{
  go_car_no.value = ''
  daozhan.value = ''
  ddmlh.value = ''
  remark.value = ''
  returnBoxShow.value = false
}
const handleReturnBox = async () =>{
  let res = await predictionBox.updataBat(ids.value.join(','),{
    go_car_no:go_car_no.value,
    daozhan:daozhan.value,
    ddmlh:ddmlh.value,
    remark:remark.value
  })
  if(res.code == 200){
    Message.success('回箱成功')
    returnBoxShow.value = false
    go_car_no.value = ''
    daozhan.value = ''
    ddmlh.value = ''
    remark.value = ''
    ids.value = []
    crudRef.value.refresh()
    return true
  }else{
    Message.error(res.message)
    return false
  }
  
}

const numberOperation = (newValue, id, numberName) => {
  predictionBox.numberOperation({ id, numberName, numberValue: newValue }).then( res => {
    res.success && Message.success(res.message)
  }).catch( e => { console.log(e) } )
}

const switchStatus = (statusValue, id, statusName) => {
  predictionBox.changeStatus({ id, statusName, statusValue }).then( res => {
    res.success && Message.success(res.message)
  }).catch( e => { console.log(e) } )
}

const columnsReturn = ref([
  {
    title: "所属公司",
    dataIndex: "dept_name",
    align: "center",
    width: 200,
    ellipsis: true,
    tooltip: true,
    slotName: "dept_name",
  },
  {
    title: "车号",
    dataIndex: "car_no",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: "箱号",
    dataIndex: "box",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: "箱型箱类",
    dataIndex: "box_type",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: "箱属",
    dataIndex: "box_belong",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },
  {
    title: "空箱/重箱",
    dataIndex: "is_empty",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
    slotName: "is_empty",
  },
  {
    title: "集装箱当前状态",
    dataIndex: "deriver_box_status",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
    slotName: "deriver_box_status",
  },{
    title: "装车司机",
    dataIndex: "driver_name",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },{
    title: "司机联系方式",
    dataIndex: "driver_mobile",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },{
    title: "装车车牌号",
    dataIndex: "driver_car_no",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },{
    title: "运出时间",
    dataIndex: "driver_detail.created_at",
    align:'center',
    width:140,
  },{
    title: "还箱车牌号",
    dataIndex: "retrun_car_no",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },{
    title: "还箱时间",
    dataIndex: "retrun_time",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
  },{
    title: "存放仓库",
    dataIndex: "warehouse_id",
    align:'center',
    width:140,
    ellipsis: true,
    tooltip: true,
    slotName: "warehouse_id",
  },
])

const options = reactive({
  id: 'flyos_prediction_order_show_items',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationWidth: 160,
  searchColNumber:6,
  searchLabelWidth:'0px',
  formOption: {
    viewType: 'modal',
    width: 600
  },
  api: predictionBox.getList,
  recycleApi: predictionBox.getRecycleList,
  add: {
    show: false,
    api: predictionBox.save,
    auth: ['prediction:box:save']
  },
  edit: {
    show: false,
    api: predictionBox.update,
    auth: ['prediction:box:update']
  },
  delete: {
    show: false,
    api: predictionBox.deletes,
    auth: ['prediction:box:delete'],
    realApi: predictionBox.realDeletes,
    realAuth: ['prediction:box:realDeletes']
  },
  recovery: {
    show: false,
    api: predictionBox.recoverys,
    auth: ['prediction:box:recovery']
  },
  import: {
    show: false,
    url: 'prediction/box/import',
    templateUrl: 'prediction/box/downloadTemplate',
    auth: ['prediction:box:import']
  },
  export: {
    show: true,
    url: 'prediction/box/export',
    auth: ['prediction:box:export']
  },
  afterRequest: (params) => {
    params.map((v, i) => {
      if (v.is_empty == 1 && v.deriver_box_status == 2) {
        v.disabled = false;
      } else {
        v.disabled = true;
      }
      if(v.prediction != null){
        v.car_no = v.prediction.car_no;
        v.dept_id = v.prediction.dept_id;
      }else{
        v.car_no = '';
        v.dept_id = '';
      }
      
    });
  },
})

const columns = reactive([
  {
    title: "",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入"
    }
  },
  {
    title: "所属公司",
    dataIndex: "dept_id",
    formType: "select",
    search: true,
    align:'center',
    width:180,
    dict: {
      // 远程通用接口请求，新版代码生成都有一个 remote 接口
      remote: "system/dept/remote",
      // 指定组件接收的props
      props: {label: "name", value: "id"},
      // 开启分页
      openPage: false,
      // 远程请求配置项
      remoteOption: {
        // 按用户名排序
        sort: {id: "desc"}, // 如果不指定排序方式，默认为正序排序
        // 设置查询的字段
        select: ["id", "name"],
        // 设置数据过滤
        filter: {
          type: ["=", 2],
          status: ['=',1]
        },
        // 关联模型
        relations: [],
      },
    },
  },
  {
    title: "车号",
    dataIndex: "car_no",
    formType: "input",
    align:'center',
    width:140,
    search: true
  },
  {
    title: "箱号",
    dataIndex: "box",
    formType: "input",
    align:'center',
    width:140,
    search: true
  },
  {
    title: "箱型箱类",
    dataIndex: "box_type",
    formType: "input",
    align:'center',
    width:140,
    search: true
  },
  {
    title: "箱属",
    dataIndex: "box_belong",
    formType: "input",
    align:'center',
    width:140,
    // search: true
  },
  
  {
    title: "集装箱支付状态",
    dataIndex: "box_pay_status",
    formType: "select",
    align:'center',
    width:140,
    dict: {
      data() {
        return [
          { label: "待支付", value: 0 },
          { label: "已支付", value: 1 },
        ];
      },
      tagColors: {
        0: 'red',
        1: 'green',
      },
      translation: true,
    },
  },
  {
    title: "空箱/重箱",
    dataIndex: "is_empty",
    formType: "select",
    align:'center',
    width:140,
    search: true,
    dict: {
      data() {
        return [
          { label: "空箱", value: 1 },
          { label: "重箱", value: 2 },
        ];
      },
      
      translation: true,
    },
  },
  {
    title: "集装箱当前状态",
    dataIndex: "deriver_box_status",
    formType: "select",
    align:'center',
    width:140,
    search: true,
    dict: {
      name:'deriver_box_status',
      // props: { label: 'label', value: 'value'},
      translation: true,
    },
  },
  {
    title: "卸火车装卸人",
    dataIndex: "prediction.load_detail.user.nickname",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "卸车装卸时间",
    dataIndex: "prediction.load_detail.over_time",
    width:140,
    align:'center',
    formType: "range",
    search: true
  },
  {
    title: "装车司机",
    dataIndex: "driver_name",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "司机联系方式",
    dataIndex: "driver_mobile",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "装车车牌号",
    dataIndex: "driver_car_no",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "提货装车时间",
    dataIndex: "driver_detail.created_at",
    width:180,
    align:'center',
    formType: "range",
    search: true,
    showTime: true
  },
  {
    title: "提货装卸人",
    dataIndex: "driver_detail.d_order.create_user.nickname",
    width:140,
    align:'center',
    formType: "input",
  },
  {
    title: "是否掏箱",
    dataIndex: "is_taoxiang",
    width:140,
    align:'center',
    formType: "select",
    // search: true
    dict: {
      data: [
        {
          label: "是",
          value: '1'
        },
        {
          label: "否",
          value: '0'
        }
      ],
      tagColors: {
        0: 'gray',
        1: 'blue',
      },
      translation: true
    }
  },
  {
    title: "还箱地点",
    dataIndex: "is_tielu",
    width:140,
    align:'center',
    formType: "select",
    search: true,
    dict:{
      data() {
        return [
          { label: "普兴站", value: '1' },
          { label: "园区", value: '2' },
        ];
      },
      translation: true,
    }
  },
  {
    title: "还箱车牌号",
    dataIndex: "retrun_car_no",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "还箱时间",
    dataIndex: "huan_time",
    width:180,
    align:'center',
    formType: "range",
    search: true,
    showTime: true
  },
  {
    title: "还箱人",
    dataIndex: "huan_user.nickname",
    width:140,
    align:'center',
    formType: "input",
  },
  {
    title: "存放仓库",
    dataIndex: "warehouse_id",
    width:180,
    align:'center',
    formType: "select",
    search: false,
    dict: {
        // 远程通用接口请求，新版代码生成都有一个 remote 接口
        remote: 'warehouse/master/remote',
        // 指定组件接收的props
        props: { label: 'name', value: 'id' },
        // 开启分页
        openPage: true,
        // 远程请求配置项
        remoteOption: {
            // 按用户名排序
            sort: { id: 'desc' }, // 如果不指定排序方式，默认为正序排序
            // 设置查询的字段
            select: [ 'id', 'name' ],
            // 设置数据过滤
            filter: {
              
            },
            // 关联模型
            relations: [
              
            ]
        }
    },

    // /warehouse/master/index

  },
  
  {
    title: "回箱火车号",
    dataIndex: "go_car_no",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "回箱时间",
    dataIndex: "hui_time",
    width:180,
    align:'center',
    formType: "range",
    search: true,
    showTime: true
  },
  {
    title: "回箱人",
    dataIndex: "hui_user.nickname",
    width:140,
    align:'center',
    formType: "input",
  },
  {
    title: "到站",
    dataIndex: "daozhan",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "调度命令号",
    dataIndex: "ddmlh",
    width:140,
    align:'center',
    formType: "input",
    search: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    width:140,
    align:'center',
    formType: "input",
  },
  // {
  //   title: "仓位ID",
  //   dataIndex: "warehouse_childs_id",
  //   formType: "input",
  //   search: true
  // },
  // {
  //   title: "仓位（横）",
  //   dataIndex: "horizontal_position",
  //   formType: "input",
  //   search: true
  // },
  // {
  //   title: "仓位（纵）",
  //   dataIndex: "release_position",
  //   formType: "input",
  //   search: true
  // },
  // {
  //   title: "仓位（层）",
  //   dataIndex: "reaches_position",
  //   formType: "input",
  //   search: true
  // },
  
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    width:180,
    align:'center',
    search: false,
    addDisplay: false,
    editDisplay: false,
    sortable: {
      sortDirections: [
        "ascend",
        "descend"
      ],
      sorter: true
    },
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'prediction:orderShowItems' } </script>